﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Messaging;
using CommunityToolkit.Mvvm.Messaging.Messages;
using System.Collections.ObjectModel;

namespace Validator.ViewModels
{
    public partial class StudentListViewModel : ObservableRecipient, IRecipient<ValueChangedMessage<string>>
    {
        public ObservableCollection<string> Student { get; } = new ObservableCollection<string>();


        [ObservableProperty]
        bool allowNew;
        partial void OnAllowNewChanged(bool value)
        {
            WeakReferenceMessenger.Default.Send(new ValueChangedMessage<bool>(value));
        }
        public void Receive(ValueChangedMessage<string> message)
        {
            Student.Add(message.Value);
        }
    }
}
